#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.16.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>

;Example()

Func FindFile($aPath)
        ; Assign a Local variable the search handle of all files in the current directory.
        ;Local $hSearch = FileFindFirstFile(@HomeDrive & "\" & @HomePath & "\*.sha1")
		Local $hSearch = FileFindFirstFile($aPath & "\*.sha1")
        ; Check if the search was successful, if not display a message and return False.
        If $hSearch = -1 Then
                MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.")
                Return False
        EndIf

        ; Assign a Local variable the empty string which will contain the files names found.
        Local $sFileName = "", $iResult = 0
		Local $data
        While 1
			$sFileName = FileFindNextFile($hSearch)
			; If there is no more file matching the search.
			If @error Then ExitLoop
			$data = $data & "|" & $sFileName
			; Display the file name.
			;$iResult = MsgBox(($MB_OKCANCEL + $MB_SYSTEMMODAL), "", "File: " & $sFileName)
			;If $iResult <> $IDOK Then ExitLoop ; If the user clicks on the cancel/close button.
        WEnd

        ; Close the search handle.
        FileClose($hSearch)
		;ConsoleWrite(StringLen($data) -1)
		$data = StringRight ($data, StringLen($data) -1 )
		;ConsoleWrite($data &@CRLF)
		return StringSplit($data, "|")
EndFunc   ;==>FindFile
